package thread;

public class TestDemo8 {
    public static void main(String[] args) {

        Thread t1 = new Thread(() -> {
            while (true) {
                System.out.println("hello thread......1");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t1");
        // t1.run();
        // run方法只是一个普通的方法
        // start方法是一个特殊的方法,可以在系统中创建线程
        t1.start();
        Thread t2 = new Thread(() -> {
            while (true) {
                System.out.println("hello thread......2");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t2");
        t2.start();
    }
}
